function out = struct_cell2array(in)
    for ct_x = 1:size(in,1)
        for ct_y = 1:size(in,2)
            in_temp = in{ct_x,ct_y};
            if ~isempty(in_temp)
                fields  = fieldnames(in_temp);
                for ct_f = 1:numel(fields)
                    eval(['temp = in_temp.',fields{ct_f},';']);
                    for ct_en = 1:numel(temp)
                        eval(['out.',fields{ct_f},'(ct_x,ct_y,ct_en) = temp(ct_en);'])
                        eval([fields{ct_f},'_f(ct_x,ct_y,ct_en) = 1;'])
                    end
                end
            end
        end
    end
    for ct_f = 1:numel(fields)
        eval(['out.',fields{ct_f},'(',fields{ct_f},'_f == 0) = nan;']);
    end
end
